#include "qbankivnes.h"
#include <QSqlQuery>
#include <QMessageBox>
#include <QDesktopWidget>


QBankiVnes::QBankiVnes(QWidget *parent)
	: QMyBaseFormWidget(parent)
{
	ui.setupUi(this);
	QDesktopWidget desk;
	QRect deskRect = desk.screenGeometry();
	ui.layoutWidget->setFixedWidth(deskRect.width() - 250);
	ui.layoutWidget->setFixedHeight(deskRect.height()-200);
	ui.lineEdit->setFocus();
}

QBankiVnes::~QBankiVnes()
{

}

void QBankiVnes::on_pushButton_clicked()
{
	QMessageBox msgBox;
	msgBox.setText(trUtf8("Записот ке биде внесен!"));
	msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
	msgBox.setDefaultButton(QMessageBox::Ok);
	int ret = msgBox.exec();
	if (ret == QMessageBox::Ok )
	{
		QSqlQuery query;
		query.prepare("insert into TBank(BankIme, BankZiro) values (:ime, :ziro)");
		query.bindValue(":ime", ui.lineEdit->text());
        query.bindValue(":ziro", ui.lineEdit_2->text());

 		if (query.exec())
		{
			emit succesfulEntryData();
		}
	}
}
void QBankiVnes::pressEscape()
{
	emit closeW();
}